<template>
    <div>
        <el-aside :width="store.state.isCollapsed?'64px':'200px'">
            <!-- <el-menu :unique-opened="true" :default-active="'route.fullPath'" :router="true" :collapse-transition="false" :collapse="store.state.isCollapsed"> -->
            <el-menu :unique-opened="true" :default-active="'route.fullPath'" :router="true" :collapse-transition="false">
                <el-menu-item index="/index">
                    <el-icon><home-filled /></el-icon>
                    <span>首页</span>
                </el-menu-item>
                <el-menu-item index="/center">
                    <el-icon><avatar /></el-icon>
                    <span>个人中心</span>
                </el-menu-item>                
                <el-sub-menu index="/user-manage" v-admin>
                    <template #title>
                        <el-icon><user-filled /></el-icon>
                        <span>用户管理</span>
                    </template>
                    <el-menu-item index="/user-manage/useradd">添加用户</el-menu-item>
                    <el-menu-item index="/user-manage/userlist">用户列表</el-menu-item>
                </el-sub-menu>
                <el-sub-menu index="/company-manage" v-admin>
                    <template #title>
                        <el-icon><Film /></el-icon>
                        <span>企业管理</span>
                    </template>
                    <el-menu-item index="/company-manage/companyadd">企业中心</el-menu-item>
                </el-sub-menu>                
                <el-sub-menu index="/carousel-manage">
                    <template #title>
                        <el-icon><Picture /></el-icon>
                        <span>轮播图管理</span>
                    </template>
                    <el-menu-item index="/carousel-manage/carouseladd">添加轮播</el-menu-item>
                    <el-menu-item index="/carousel-manage/carousellist">轮播列表</el-menu-item>
                </el-sub-menu>
                <el-sub-menu index="/cooperation-manage">
                    <template #title>
                        <el-icon><Connection /></el-icon>
                        <span>合作企业</span>
                    </template>
                    <el-menu-item index="/cooperation-manage/cooperationadd">添加企业</el-menu-item>
                    <el-menu-item index="/cooperation-manage/cooperationlist">企业列表</el-menu-item>
                </el-sub-menu>
                <el-sub-menu index="/message-feedback">
                    <template #title>
                        <el-icon><Comment /></el-icon>                        
                        <span>留言反馈</span>
                    </template>                    
                    <el-menu-item index="/message-feedback/messagelist">留言列表</el-menu-item>
                </el-sub-menu>
                <el-sub-menu index="/news-manage">
                    <template #title>
                        <el-icon><message-box /></el-icon>
                        <span>新闻管理</span>
                    </template>
                    <el-menu-item index="/news-manage/newsadd">添加新闻</el-menu-item>
                    <el-menu-item index="/news-manage/newslist">新闻列表</el-menu-item>
                </el-sub-menu>
                <el-sub-menu index="/product-manage">
                    <template #title>
                        <el-icon><Shop /></el-icon>
                        <span>产品管理</span>
                    </template>
                    <el-menu-item index="/product-manage/productadd">添加产品</el-menu-item>
                    <el-menu-item index="/product-manage/productlist">产品列表</el-menu-item>
                </el-sub-menu>
            </el-menu>
        </el-aside>
    </div>
</template>

<script setup>
import {HomeFilled,Avatar,UserFilled,MessageBox,Shop,Pointer,Picture,Film,Connection,Comment} from '@element-plus/icons-vue';
import {useStore} from 'vuex'
const store=useStore()
const vAdmin={
    mounted(e){
        if(store.state.user.role!==1){
            e.parentNode.removeChild(e)
        }
    }
}

</script>

<style lang="scss" scoped>
    .el-aside{
        height:100vh;
        .el-menu{
            height: 100vh;
        }
    }
</style>